(function(){"use strict";BX.namespace("BX.Landing.UI.Card");var i=BX.Landing.Utils.addClass;var e=BX.Landing.Utils.removeClass;var t=BX.Landing.Utils.slice;var a=BX.Landing.Utils.Show;var r=BX.Landing.Utils.Hide;BX.Landing.UI.Card.Library=function(i){BX.Landing.UI.Card.BaseCard.apply(this,arguments);this.layout.classList.add("landing-ui-card-library");this.searchLabel=!!i.searchLabel?i.searchLabel:"";this.searchPlaceholder=!!i.searchPlaceholder?i.searchPlaceholder:"";this.serchTipsList=!!i.searchTips?i.searchTips:[];this.onChangeHandler=typeof i.onChange==="function"?i.onChange:function(){};this.search=BX.create("div",{props:{className:"landing-ui-card-library-search"}});this.searchField=this.createSearchField();this.searchTips=this.createSearchTips();if(i.description){this.description=BX.create("div",{props:{className:"landing-ui-card-library-description"},html:i.description});this.searchField.layout.insertBefore(this.description,this.searchField.input)}this.search.appendChild(this.searchField.layout);this.search.appendChild(this.searchTips.layout);this.body.appendChild(this.search);this.loader=new BX.Loader({target:this.body});this.imageList=BX.create("div",{props:{className:"landing-ui-card-library-list"}});this.body.appendChild(this.imageList);this.bottomLoader=new BX.Loader({target:this.body,mode:"inline",offset:{left:"calc(50% - 55px)"}});this.loadMore=BX.create("div",{props:{className:"landing-ui-card-library-load-more"}});this.loadMoreButton=this.createLoadMoreButton();this.loadMore.hidden=true;this.loadMore.dataset.isShown="false";this.loadMore.appendChild(this.loadMoreButton.layout);this.body.appendChild(this.loadMore)};BX.Landing.UI.Card.Library.prototype={constructor:BX.Landing.UI.Card.Library,__proto__:BX.Landing.UI.Card.BaseCard.prototype,onSearchInput:function(i){},onTipsChange:function(i){this.searchField.setValue(i)},onLoadMore:function(){},onChange:function(i){this.onChangeHandler(i)},renderItems:function(e){e.forEach((function(e){var t=new BX.Landing.UI.Card.ImagePreview(e);this.imageList.appendChild(t.layout);requestAnimationFrame((function(){i(t.layout,"landing-ui-show")}))}),this)},showEmptyResult:function(){if(!this.empty){this.empty=BX.create("div",{props:{className:"landing-ui-card-library-empty"},html:BX.Landing.Loc.getMessage("LANDING_IMAGES_PANEL_EMPTY_RESULT")});BX.insertAfter(this.empty,this.imageList)}return a(this.empty)},hideEmptyResult:function(){if(this.empty){return r(this.empty)}},showError:function(){if(!this.error){this.error=BX.create("div",{props:{className:"landing-ui-card-library-error"},html:BX.Landing.Loc.getMessage("LANDING_IMAGES_PANEL_ERROR")||"Error"});BX.insertAfter(this.error,this.imageList)}this.hideEmptyResult();this.hideLoadMore();this.hideBottomLoader();this.hideLoadMore();this.hideLoader();this.clearItems();return a(this.error)},hideError:function(){if(this.error){return r(this.error)}},clearItems:function(){this.imageList.innerHTML=""},createLoadMoreButton:function(){return new BX.Landing.UI.Button.BaseButton("load_more",{text:BX.Landing.Loc.getMessage("LANDING_IMAGE_LIBRARY_LOAD_MORE"),className:"landing-ui-card-library-load-more-button",onClick:this.onLoadMore.bind(this)})},createSearchTips:function(){return new BX.Landing.UI.Field.ButtonGroup({items:this.serchTipsList,className:"landing-ui-card-library-search-tips",onChange:this.onTipsChange.bind(this)})},createSearchField:function(){var i=new BX.Landing.UI.Field.Unit({onInput:this.onSearchInput.bind(this),className:"landing-ui-card-library-search-field",placeholder:BX.Landing.Loc.getMessage("SEARCH_FIELD_PLACEHOLDER"),title:this.searchLabel,skipPasteControl:true});i.input.type="text";i.input.min=null;i.input.max=null;i.enableTextOnly();return i},showLoader:function(){t(this.imageList.children).forEach((function(i){e(i,"landing-ui-show")}));this.loader.show()},hideLoader:function(){this.loader.hide()},showBottomLoader:function(){this.bottomLoader.show()},hideBottomLoader:function(){this.bottomLoader.hide()},showLoadMore:function(){BX.Landing.Utils.Show(this.loadMore)},hideLoadMore:function(){BX.Landing.Utils.Hide(this.loadMore)}}})();
//# sourceMappingURL=base_image_library_card.map.js